module.exports = function($scope, $state, $stateParams, $modalInstance, $resource,$modal,FileUploader,toaster,item){
    $scope.info = item;
    if(item){
        var id = item.id;        
    }
    // console.log(id);
	$scope.ok = function(){
        var url = '';
        if(id){
            url = '/api/as/mc/mermessage/updateMessage';
        } else {
            url = '/api/as/mc/mermessage/saveMessage';
        }
		$resource(url, {}, {}).
		save($scope.info, function(res){
			console.log($scope.info);
			if(res.errcode === 0)
			{
                toaster.success({title:"",body:"操作成功"});
				$modalInstance.close();
			}
			else
			{
                toaster.error({title:"",body:res.errmsg});				
			}
 
		});

	}
    $scope.cancel = function(){
		$modalInstance.close();
	}




};